package com.mmy.dao.guide;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.mmy.domain.guide.VGuideInfo;

public interface VGuideInfoRepository extends JpaRepository<VGuideInfo, Integer> {
	/* 通过ID查询 */
	@Query(value = "select * from vGuideInfo where iGuideID=?1", nativeQuery = true)
	VGuideInfo findByID(int iGuideID);

	/*
	 * 根据查询条件查找
	 */
	@Query(value = "select *  from  vGuideInfo where (cGuideName like %:cGuideName%) and (:bSex = \"\" or bSex = :bSex) and (cGuideLevel like %:cGuideLevel%) and (cLanguage like %:cLanguage%) and (:iOrgID = \"\" or iOrgID = :iOrgID)", nativeQuery = true)
	List<VGuideInfo> findSearch(@Param("cGuideName") String strGuideName, @Param("bSex") String strSex,
			@Param("cGuideLevel") String strGuideLevel, @Param("cLanguage") String strLanguage,
			@Param("iOrgID") String strOrgID);

}
